package com.brokendust.client.config.module.button;

import com.brokendust.client.api.util.image.ImageControl;
import com.brokendust.client.config.module.ComponentJson;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.ArrayList;
import java.util.List;

public class ClickButtonJson implements ComponentJson {
    public String type;
    public String display_name;
    List<String> leftList;
    List<String> rightList;
    List<String> leftShiftList;
    List<String> rightShiftList;
    private String object_name;
    private int font_size;
    private String image_on;
    private String image_off;
    private int width_on;
    private int height_on;
    private int width_off;
    private int height_off;
    private int position;
    private int x;
    private int y;
    private boolean close;
    private String to_menu;
    private List<String> custom_action_list;

    public ClickButtonJson() {
        this.type = "Button";
        this.object_name = "";
        this.display_name = "";
        this.image_on = "";
        this.image_off = "";
        this.leftList = new ArrayList<String>();
        this.rightList = new ArrayList<String>();
        this.leftShiftList = new ArrayList<String>();
        this.rightShiftList = new ArrayList<String>();
        this.custom_action_list = new ArrayList<String>();
    }

    public static ClickButtonJson readJSON(String string) {
        GsonBuilder builder = new GsonBuilder();
        Gson gson = builder.create();
        return gson.fromJson(string, ClickButtonJson.class);
    }

    public void refreshSize() {
        if (this.width_on == 0) {
            this.width_on = ImageControl.getWidth(this.image_on);
        }
        if (this.height_on == 0) {
            this.height_on = ImageControl.getHeight(this.image_on);
        }
        if (this.width_off == 0) {
            this.width_off = ImageControl.getWidth(this.image_off);
        }
        if (this.height_off == 0) {
            this.height_off = ImageControl.getHeight(this.image_off);
        }
    }

    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDisplay_name() {
        return this.display_name;
    }

    public void setDisplay_name(String display_name) {
        this.display_name = display_name;
    }

    public int getFont_size() {
        return this.font_size;
    }

    public void setFont_size(int font_size) {
        this.font_size = font_size;
    }

    public String getImage_on() {
        return this.image_on;
    }

    public void setImage_on(String image_on) {
        this.image_on = image_on;
    }

    public String getImage_off() {
        return this.image_off;
    }

    public void setImage_off(String image_off) {
        this.image_off = image_off;
    }

    public int getWidth_on() {
        return this.width_on;
    }

    public void setWidth_on(int width_on) {
        this.width_on = width_on;
    }

    public int getHeight_on() {
        return this.height_on;
    }

    public void setHeight_on(int height_on) {
        this.height_on = height_on;
    }

    public int getWidth_off() {
        return this.width_off;
    }

    public void setWidth_off(int width_off) {
        this.width_off = width_off;
    }

    public int getHeight_off() {
        return this.height_off;
    }

    public void setHeight_off(int height_off) {
        this.height_off = height_off;
    }

    public boolean isClose() {
        return this.close;
    }

    public void setClose(boolean close) {
        this.close = close;
    }

    public String getTo_menu() {
        return this.to_menu;
    }

    public void setTo_menu(String to_menu) {
        this.to_menu = to_menu;
    }

    public List<String> getLeftList() {
        return this.leftList;
    }

    public void setLeftList(List<String> leftList) {
        this.leftList = leftList;
    }

    public List<String> getRightList() {
        return this.rightList;
    }

    public void setRightList(List<String> rightList) {
        this.rightList = rightList;
    }

    public List<String> getLeftShiftList() {
        return this.leftShiftList;
    }

    public void setLeftShiftList(List<String> leftShiftList) {
        this.leftShiftList = leftShiftList;
    }

    public List<String> getRightShiftList() {
        return this.rightShiftList;
    }

    public void setRightShiftList(List<String> rightShiftList) {
        this.rightShiftList = rightShiftList;
    }

    public int getPosition() {
        return this.position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public int getX() {
        return this.x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return this.y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public String getObject_name() {
        return this.object_name;
    }

    public void setObject_name(String object_name) {
        this.object_name = object_name;
    }

    public List<String> getCustom_action_list() {
        return this.custom_action_list;
    }

    public void setCustom_action_list(List<String> custom_action_list) {
        this.custom_action_list = custom_action_list;
    }
}
